<div class="datatables_block">
<table class='healthchecks-table'>
    <thead>
        <tr>
            <th class='check'><span data-asc="d" data-desc="a" class='label'>Status</span></th>
            <th class='host'>Host</th>
            <th>Check</th>
            <th class='output'>Output</th>
            <th class='last_check'><span data-asc="d" data-desc="a" class='label' >Last check</span></th>
        </tr>
    </thead>
    <tbody>    
{% for check in result %}
<tr id="row-{{ check|mongo_id }}">
<td data-order='{% if check.last_check.status == "critical" %}0{% else %}{% if check.last_check.status == "warning" %}1{% else %}2{% endif %}{% endif %}'
    ><span class="health-checks--status {{check.last_check.status}}">{{check.last_check.status}}</span></td>
    <td><a href="{% url 'server_system' server_id=check.server|mongo_id %}">{{check.server.name}}</a></td>
    <td>{{check.command}} {{check.params|empty_if_none}}</td>
    <td><span class='result' title="{{check.last_check.output}}">{{check.last_check.output|truncatechars:150}}</span>
        {% if check.last_check.error %}
            <span class="error">{{check.last_check.error}}</span>
        {% endif %}
    </td>
    <td class='last_check-column'>
        <span time-ago class="last_check" title="{{ check.last_check.time|datetime_local:request.timezone }}">{{check.last_check.time}}</span>
    

         <a title='Delete' class='delete_row button delete' data-rowid="{{ check|mongo_id }}" href="#" data-icon="b" ></a>



    </td>
    
</tr>
    <div class="delete-row" id="delete-row-{{ check|mongo_id }}">
    <p>
        Are you sure you want to delete this health check?
    </p>
    <ul>
        <li>
            <a href="{% url 'delete_healthcheck' check_id=check|mongo_id  %}" class="button delete">Delete</a>
        </li>
        <li>
            <a data-rowid="{{ check|mongo_id  }}" href="" class="button cancel">Cancel</a>
        </li>
    </ul>
    </div>
{% endfor %}

</tbody>
</table>
</div> <!-- datatables block -->
